package ChessEngine;

import boardData.Board;

/**
 *  Piece-Square Tables für die einzelnen Figuren
 *  Die Tabellen geben die Wertigkeiten für die jeweilige Figur auf dem Brett wieder.
 *  
 *  Negative Zahl = schlechte Bewertung
 *  Positive Zahl = gute Bewertung
 *  
 *   Quelle: http://chessprogramming.wikispaces.com/Simplified+evaluation+function
 *   	     http://chessprogramming.wikispaces.com/Piece-Square+Tables
 *   
 */

public class PieceSquareTables {
	public int whitePawnTable[] = {
									   0,  0,   0,   0,   0,   0,  0,  0,   
									  50, 50,  50,  50,  50,  50, 50, 50, 
									  10, 10,  20,  30,  30,  20, 10, 10, 
									   5,  5,  10,  25,  25,  10,  5,  5, 
									   0,  0,  0,   20,  20,   0,  0,  0, 	
									   5, -5, -10,   0,   0, -10, -5,  5, 
									   5, 10,  10, -20, -20,  10, 10,  5, 
									   0,  0,   0,   0,   0,   0, 0,   0	
								    };
	
	public int blackPawnTable[] = {
			    0,   0,    0,   0,   0,   0,   0,   0,   
			   -5, -10,  -10,  20,  20, -10, -10,  -5, 
			   -5,   5,   10,   0,   0,  10,   5,  -5, 
			    0,   0,    0, -20, -20,   0,   0,   0,  	
			   -5,  -5,  -10, -25, -25, -10,  -5,  -5, 
			  -10, -10,  -20, -30, -30, -20, -10, -10,
			  -50, -50,  -50, -50, -50, -50, -50, -50, 
			    0,   0,   0,    0,   0,   0,   0,   0	
		    };
	
	private int whiteKnightTable[] = {
									  -50, -40, -30, -30, -30, -30, -40, -50,   
									  -40, -20,   0,   0,   0,   0, -20, -40, 
									  -30,   0,  10,  15,  15,  10,   0, -30, 
									  -30,   5,  15,  20,  20,  15,   5, -30, 
									  -30,   0,  15,  20,  20,  15,   0, -30, 
									  -30,   5,  10,  15,  15,  10,   5, -30, 
									  -40, -20,   0,   5,   5,   0, -20, -40, 
									  -50, -40, -30, -30, -30, -30, -40, -50 
		    						};
	
	private int blackKnightTable[] = {			   
			  50,  40,  30,  30,  30,  30,  40, 50, 
			  40,  20,   0,  -5,  -5,   0,  20, 40,
			  30,   5, -10, -15, -15, -10,  -5, 30,
			  30,   0, -15, -20, -20, -15,   0, 30,
			  30,  -5, -15, -20, -20, -15,  -5, 30,
			  30,   0, -10, -15, -15, -10,   0, 30,
			  40,  20,   0,   0,   0,   0,  20, 40,
			  50,  40,  30,  30,  30,  30,  40, 50
			};
	
	private int whiteBishopTable[] = {
										-20, -10, -10, -10, -10, -10, -10, -20,   
										-10,   0,   0,   0,   0,   0,   0, -10, 
										-10,   0,   5,  10,  10,   5,   0, -10, 
										-10,   5,   5,  10,  10,   5,   5, -10, 
										-10,   0,  10,  10,  10,  10,   0, -10, 
										-10,  10,  10,  10,  10,  10,  10, -10, 
										-10,   5,   0,   0,   0,   0,   5, -10, 
										-20, -10, -10, -10, -10, -10, -10, -20 
									 };
	
	private int blackBishopTable[] = {			
			20, 10, 10,  10,  10, 10, 10, 20, 
			10, -5,  0,   0,   0,  0, -5, 10,
			10, 10, 10,  10,  10, 10, 10, 10,
			10,  0, 10,  10,  10, 10,  0, 10,
			10, -5, -5, -10, -10, -5, -5, 10,
			10,  0, -5, -10, -10, -5,  0, 10,
			10,  0,  0,   0,   0,  0,  0, 10,
			20, 10, 10,  10,  10, 10, 10, 20
		 };
	
	private int whiteRookTable[] = {
										 0,  0,  0,  0,  0,  0,  0,  0,   
										 5, 10, 10, 10, 10, 10, 10,  5, 
										-5,  0,  0,  0,  0,  0,  0, -5, 
										-5,  0,  0,  0,  0,  0,  0, -5, 
										-5,  0,  0,  0,  0,  0,  0, -5, 
										-5,  0,  0,  0,  0,  0,  0, -5, 
										-5,  0,  0,  0,  0,  0,  0, -5, 
										 0,  0,  0,  5,  5,  0,  0,  0 
									 };
	
	private int blackRookTable[] = {			 
			  0,   0,   0,  -5,  -5,   0,   0,  0, 
			  5,   0,   0,   0,   0,   0,   0, -5,
			  5,   0,   0,   0,   0,   0,   0, -5,
			  5,   0,   0,   0,   0,   0,   0, -5,
			  5,   0,   0,   0,   0,   0,   0, -5,
			  5,   0,   0,   0,   0,   0,   0, -5,
			 -5, -10, -10, -10, -10, -10, -10, -5,
			  0,   0,   0,   0,   0,   0,   0,  0
		 };
	
	private int whiteQueenTable[] = {
										-20, -10, -10,  -5,  -5, -10, -10, -20,   
									    -10,   0,   0,   0,   0,   0,   0, -10, 
										-10,   0,   5,   5,   5,   5,   0, -10, 
										 -5,   0,   5,   5,   5,   5,   0,  -5,
										  0,   0,   5,   5,   5,   5,   0,   0, 
										-10,   5,   5,   5,   5,   5,   0, -10, 
										-10,   0,   5,   0,   0,   0,   0, -10, 
										-20, -10, -10,  -5,  -5, -10, -10, -20 
		 							};	
	
	public int blackQueenTable[] = {
			20, 10, 10,  5,  5, 10, 10, 20,
			10,  0,  0,  0,  0,  5,  0, 10,
			10, -5, -5, -5, -5, -5,  0, 10,
			 0,  0, -5, -5, -5, -5,  0,  0,
			 5,  0, -5, -5, -5, -5,  0,  5,
			10,  0, -5, -5, -5, -5,  0, 10,
			10,  0,  0,  0,  0,  0,  0, 10,
			20, 10, 10,  5,  5, 10, 10, 20,
			
	    };
	
	private int whiteKingMiddleGameTable[] = {
										 -30, -40, -40, -50, -50, -40, -40, -30,   
										 -30, -40, -40, -50, -50, -40, -40, -30, 
										 -30, -40, -40, -50, -50, -40, -40, -30, 
										 -30, -40, -40, -50, -50, -40, -40, -30, 
										 -20, -30, -30, -40, -40, -30, -30, -20, 
										 -10, -20, -20, -20, -20, -20, -20, -10, 
										  20,  20,   0,   0,   0,   0,  20,  20, 
										  20,  30,  10,   0,   0,  10,  30,  20 
									};
	
	private int blackKingMiddleGameTable[] = {			
			  -20, -30, -10,  0,  0, -10, -30, -20, 
			  -20, -20,   0,  0,  0,   0, -20, -20,
			   10,  20,  20, 20, 20,  20,  20,  10,
			   20,  30,  30, 40, 40,  30,  30,  20,
			   30,  40,  40, 50, 50,  40,  40,  30,
			   30,  40,  40, 50, 50,  40,  40,  30,
			   30,  40,  40, 50, 50,  40,  40,  30,
			   30,  40,  40, 50, 50,  40,  40,  30
		};
	
	
	
	private int whiteKingEndGameTable[] = {
										-50, -40, -30, -20, -20, -30, -40, -50,
										-30, -20, -10,   0,   0, -10, -20, -30,
										-30, -10,  20,  30,  30,  20, -10, -30,
										-30, -10,  30,  40,  40,  30, -10, -30,
										-30, -10,  30,  40,  40,  30, -10, -30,
										-30, -10,  20,  30,  30,  20, -10, -30,
										-30, -30,   0,   0,   0,   0, -30, -30,
										-50, -30, -30, -30, -30, -30, -30, -50
									};
	
	private int blackKingEndGameTable[] = {			
			 50, 30,  30,  30,  30,  30, 30, 50,
			 30, 30,   0,   0,   0,   0, 30, 30,
			 30, 10, -20, -30, -30, -20, 10, 30,
			 30, 10, -30, -40, -40, -30, 10, 30,
			 30, 10, -30, -40, -40, -30, 10, 30,
			 30, 10, -20, -30, -30, -20, 10, 30,
			 30, 20,  10,   0,   0,  10, 20, 30,
			 50, 40,  30,  20,  20,  30, 40, 50
		};
	
	/* 
	 * Es folgen die getter für weiss
	 */
	
	public int getWhitePawnEvaluation(int pos) {
		return this.whitePawnTable[pos];
	}
	
	public int getWhiteBishopEvaluation(int pos) {
		return this.whiteBishopTable[pos];
	}
	
	public int getWhiteKnightEvaluation(int pos) {
		return this.whiteKnightTable[pos];
	}
	
	public int getWhiteRookEvaluation(int pos) {
		return this.whiteRookTable[pos];
	}
	
	public int getWhiteQueenEvaluation(int pos) {
		return this.whiteQueenTable[pos];
	}
	
	public int getWhiteKingMiddleGameEvaluation(int pos) {
		return this.whiteKingMiddleGameTable[pos];
	}
	
	public int getWhiteKingEndGameEvaluation(int pos) {
		return this.whiteKingEndGameTable[pos];
	}
	
	
	/*
	 * get fuer Schwarz
	 */
	public int getBlackPawnEvaluation(int pos) {
		return this.blackPawnTable[pos];
	}
	
	public int getBlackBishopEvaluation(int pos) {
		return this.blackBishopTable[pos];
	}
	
	public int getBlackKnightEvaluation(int pos) {
		return this.blackKnightTable[pos];
	}
	
	public int getBlackRookEvaluation(int pos) {
		return this.blackRookTable[pos];
	}
	
	public int getBlackQueenEvaluation(int pos) {
		return this.blackQueenTable[pos];
	}
	
	public int getBlackKingMiddleGameEvaluation(int pos) {
		return this.blackKingMiddleGameTable[pos];
	}
	
	public int getBlackKingEndGameEvaluation(int pos) {
		return this.blackKingEndGameTable[pos];
	}		
}
